package com.service.provider2.dao;


import com.api.demo.entities.Dept;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeptDAO  {

    String DB_NAME = "dept";
    String SELECT_FILEDS = "deptno, dname, dp_source";

    @Insert({"insert into ", DB_NAME, "(dname, dp_source) values(#{dname}, #{dp_source})"})
    boolean add(Dept dept);

    @Select({"select ", SELECT_FILEDS, "from ", DB_NAME, "where deptno = #{deptno}" })
    Dept get(Long id);

    @Select({"select * from ", DB_NAME})
    List<Dept> list();

}
